﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="MyVideos.aspx.cs" Inherits="AiXiu.WebSite.MyVideos" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1,user-scalable=no" />
    <meta name="apple-mobile-web-app-capable" content="yes" />
    <meta name="apple-mobile-web-app-status-bar-style" content="black" />
    <title>我发布的视频</title>
    <link href="Content/mui/css/mui.min.css" rel="stylesheet" />
    <link href="Content/mui/css/app.css" rel="stylesheet" />
    <link href="Content/common.css" rel="stylesheet" />
    <style>
        #OA_task_1 img {
            width: 20%;
            height: 70px;
            float: left;
            margin-right: 6px;
        }

        #OA_task_1 > li {
            margin-bottom: 4px;
        }
    </style>
</head>
<body>
    <header class="mui-bar mui-bar-nav">
        <a class="mui-icon mui-icon-left-nav mui-pull-left" href="Personal.aspx"></a>
        <h1 class="mui-title">我发布的视频</h1>
    </header>
    <div class="mui-content">
        <ul id="OA_task_1" class="mui-table-view">
            <asp:Repeater ID="rptVideos" runat="server">
                <ItemTemplate>
                    <li class="mui-table-view-cell" id="<%#Eval("VideoId") %>">
                        <div class="mui-slider-right mui-disabled">
                            <a class="mui-btn mui-btn-red">删除</a>
                        </div>
                        <div class="mui-slider-handle">
                            <img src="<%#Eval("CoverURL") %>" />
                            <div><%#Eval("Headline") %></div>
                            <span><%#GetVideoStatus(Convert.ToInt32(Eval("Status"))) %></span>
                        </div>
                    </li>
                </ItemTemplate>
            </asp:Repeater>
        </ul>

    </div>
    <script src="Scripts/jquery-1.8.3.min.js"></script>
    <script src="Content/mui/js/mui.min.js"></script>
    <script>
        mui.init();
        (function ($) {
            var btnArray = ['确认', '取消'];
            $('#OA_task_1').on('tap', '.mui-btn', function (event) {
                var elem = this;
                var li = elem.parentNode.parentNode;
                mui.confirm('确认删除该条记录？', 'Hello MUI', btnArray, function (e) {
                    //确认删除
                    if (e.index == 0) {
                        var videoid = li.id;
                        $.post("/Handler/VideoDeleteHandler.ashx", { videoId: videoid }, function (data) {
                            //jQuery代替$,解决冲突
                            data = jQuery.parseJSON(data)
                            console.log(data)
                            if (data.StatusCode == 0) {
                                //删除节点
                                li.parentNode.removeChild(li);
                            } else {
                                alert(data.Message);
                            }

                        })

                    }
                    //取消删除
                    else {
                        setTimeout(function () {
                            $.swipeoutClose(li);
                        }, 0);
                    }


                });
            });
        })(mui);
    </script>
</body>
</html>
